<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    let  xhr  = new XMLHttpRequest();
    console.log("a",xhr.readyState);//0

    xhr.open("get","01.json");
    console.log("b",xhr.readyState);//1

    xhr.send();
    console.log("c",xhr.readyState);//1

    xhr.onreadystatechange  = function(){
        console.log("d",xhr.readyState);//2 3 4
        console.log(xhr.responseText);

        if(xhr.readyState==4 && xhr.status==200){
            let text = xhr.responseText;
            console.log(text);
        }
    }

</script>
</html>